package com.ztsoft.user.utils;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;

import javax.annotation.PostConstruct;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;

@Slf4j
@Component
public class FileUtils {

    @Value("${file.exportWord}")
    private String exportWord;

    private static String exportWord2;

    @PostConstruct
    private void getExportWord() {
        exportWord2 = exportWord;
    }

    public static InputStream getResources(String fileName) throws IOException {
        File file = new File(exportWord2 + fileName);
        return new FileInputStream(file);
    }
}
